package com.ogilvy.common;

import com.ogilvy.cms.bean.CmsTemplate;
import com.ogilvy.frame.util.CmsUtils;

import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;

public class CmsTemplateJsonValueProcessorImpl implements JsonValueProcessor{

	public Object processArrayValue(Object arg0, JsonConfig arg1) {
		
		return UtilTools.encodeObject2Json(arg0);
	}

	public Object processObjectValue(String arg0, Object value, JsonConfig arg2) {
		if(CmsUtils.isEmpty(value))
			return "";
		//if(arg0.equals("cmt")){
		CmsTemplate ctp = (CmsTemplate)value;
			return ctp.getCmtId()+ ";" + ctp.getCmtName();
		/*}
		return UtilTools.encodeObject2Json(arg0);*/
	}

}
